<?php 
namespace Admin\Controller;
/**
 * 后台用户控制器
 * @author 麦当苗儿 <zuojiazi@vip.qq.com>
 */
class OrderController extends AdminController {
public function index(){
        $name = I('name');
        $map['status']  =   array('egt',0);
        if(is_numeric($name)){
            $map['id|name']=   array(intval($name),array('like','%'.$name.'%'),'_multi'=>true);
        }else{
            $map['name']    =   array('like', '%'.(string)$name.'%');
        }
        $list   = $this->lists('order', $map);
        foreach ($list as $k => $v) {
            $goods=M('goods')->where(array('id'=>$v['gid']))->field('name')->find();
            $attrval = M('attrval')->where(array('id'=>array('in',$v['attrvid'])))->field('value')->select();
            $list[$k]['gname']=$goods['name'];
            $list[$k]['attrval']= implode(',',array_column($attrval,'value')); 
        }
        // var_dump($list);
        int_to_string($list);
        $this->assign('list',$list);
        
        $this->display();
}
}
 ?>